#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int rob(vector<int>& nums)
    {
        int n = nums.size();
        int dp[101];
        dp[0] = nums[0];
        if (n > 1)
        {
            dp[1] = max(dp[0], nums[1]);
        }
        for (int i = 2; i < n; i++)
        {
            dp[i] = max(dp[i - 1], (dp[i - 2] + nums[i]));
        }
        return dp[n - 1];

    }
};


class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> vv(numRows);
        for (size_t i = 0; i < numRows; i++) {
            vv[i].resize(i + 1, 1);
        }
        for (int i = 0; i < numRows; i++) {
            for (int j = 1; j < vv[i].size() - 1; j++) {
                vv[i][j] = vv[i - 1][j - 1] + vv[i - 1][j];
            }
        }
        return vv;
    }
};


class Solution {
public:
    int climbStairs(int n)
    {
        int dp[46];
        dp[0] = 1, dp[1] = 2;
        for (int i = 2; i < n; i++)
        {
            dp[i] = dp[i - 1] + dp[i - 2];
        }
        return dp[n - 1];
    }
};